﻿@model Nop.Web.Models.ShareBuy.ShareBuyModel
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";
    //title
    Html.AddTitleParts(Model.Title);
    //description
    Html.AddMetaDescriptionParts(Model.Description);
}
@Html.HiddenFor(model => model.Id)
<link href="/Scripts/ad-gallery/ad-gallery.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/ad-gallery/jquery.ad-gallery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.ad-gallery').adGallery({
            slideshow:{enable: false,controls:false}
        });

        $("#btnVote").click(function () {
            $.ajax({
                cache:false,
                type: "POST",
                url: "@Url.Action("AddVote", "ShareBuy")",
                data: { "shareBuyItemId": @Model.Id },
                success: function (data) {
                    if(data.Result==true)
                    {
                        alert("successfully");
                    }
                    else if(data.Result=="Exists"){
                        alert("you had voted");
                    }
                    else
                    {
                        alert('Failed to add Sharing.');
                    }
                    $(this).attr('disabled', false);
                },
                error:function (xhr, ajaxOptions, thrownError){
                    alert('Failed to add Sharing.')
                    $(this).attr('disabled', false);
                }  
            });
        });
    });
</script>

<div class="root61">
    <div class="main w">
        <div class="g-0">
            <div class="g-0">
                <div class="c-a10">
                    <div id="discuss" class="m">
                        <div class="mt">
                            <h2>
                                @Model.Title</h2>
                            <div class="partake">
                                <span>Share to：@Html.Action("ShareButton", "Catalog")</span>
                            </div>
                        </div>
                        <div id="replyList" class="mc">
                            <table cellspacing="0" cellpadding="0" border="0">
                                <tbody valign="top">
                                    <tr class="fore">
                                        <td class="user">
                                            <div class="u-icon">
                                                
                                                    <img width="60" height="60" src="@Model.CustomerAvatarUrl">
                                                
                                            </div>
                                            <div class="u-name">
                                               @Model.CustomerName
                                            </div>
                                            <div class="u-address">
                                            </div>
                                        </td>
                                        <td class="cont">
                                            <div class="item">
                                                <div class="i-item">
                                                    @Model.Description
                                                </div>
                                                <div id="preview">
                                                    <div id="gallery" class="ad-gallery">
                                                        <div class="ad-image-wrapper">
                                                        </div>
                                                        <div class="ad-controls">
                                                        </div>
                                                        <div class="ad-nav">
                                                            <div class="ad-thumbs">
                                                                <ul class="ad-thumb-list">
                                                                    @foreach (var picture in Model.ShareBuyPictureModels)
                                                                    {
                                                                        <li><a href="@picture.PictureUrl">
                                                                            <img src="@picture.PictureUrl90"/>
                                                                        </a></li>
                                                                    }
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="item-info">
                                                    <div class="fl">
                                                        <a href="#reply">Reply</a>
                                                    </div>
                                                    <div class="fr">
                                                        Shared on @Model.CreatedOnUtc
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <!-- Comments -->
                            @if (Model.ShareBuyCommentModels.Count > 0)
                            {
                                int i = 1;
                                foreach (var comment in Model.ShareBuyCommentModels)
                                {
                                <table cellspacing="0" cellpadding="0" border="0">
                                    <tbody valign="top">
                                        <tr>
                                            <td class="user">
                                                <div class="u-icon">
                                                    <img width="60" height="60" src="@comment.CustomerAvatarUrl">
                                                </div>
                                                <div class="u-name">
                                                    @comment.CustomerName

                                                </div>
                                                <div class="u-address">
                                                </div>
                                            </td>
                                            <td valign="top" class="cont">
                                                <div class="item">
                                                    <div class="i-item">
                                                        @comment.CommentText
                                                    </div>
                                                    <div class="item-info">
                                                        <div class="fl">
                                                            <a href="#reply">Reply</a>
                                                        </div>
                                                        <div class="fr">
                                                            Reply on @comment.CreatedOn
                                                        </div>
                                                    </div>
                                                    <div class="floor">
                                                        @i floor
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                    i++;
                                }

                            }
                        </div>
                    </div>
                    <!-- discuss end -->
                    <div class="m clearfix">
                        <div class="pagin pagin-m fr">
                        </div>
                        <!--pagin end-->
                    </div>
                    @using (Html.BeginForm())
                    {
                        <div id="reply" class="m">
                            <div class="mt">
                                <h2>Reply</h2>
                            </div>
                            <div class="mc">
                                <div class="item">
                                    <div class="tit">
                                        Content：
                                    </div>
                                    <div class="cont">
                                        <div class="i-cont">
                                            @Html.TextAreaFor(x => x.AddShareBuyCommentModel.CommentText, new { style = " Height: 150px;" })
                                        </div>
                                    </div>
                                </div>
                                <div class="item">

                                    <button type="submit" name="save" value="Submit" class="btn-reply">
                                        Submit</button>
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
            <!-- replyend -->
        </div>
        <div class="g-a1 c-0">
            <!--pinfo start-->
            <div id="pinfo" class="m">
                <div class="mt">
                    <h2>Product</h2>
                </div>
                <div class="mc">
                    <div class="p-img">
                        <a target="_blank" href="@Url.RouteUrl("Product", new { productId = Model.ProductId, SeName = Model.ProductSeName })">
                            <img src="@Model.ProductVariantModel.PictureModel.ImageUrl"
                                alt="">
                        </a>
                    </div>
                    <div class="p-name">
                        Name：<a target="_blank" href="@Url.RouteUrl("Product", new { productId = Model.ProductId, SeName = Model.ProductSeName })">@Model.ProductName</a>
                    </div>
                    <div class="p-price">
                        Price：@Model.ProductVariantModel.ProductVariantPrice.Price
                    </div>
                    <div class="num-comment">
                        Comments：<span>@Model.ShareBuyCommentModels.Count</span>
                    </div>
                    @*<div class="btn">
                        <a href="#" class="btn-append">Add to cart</a>
                    </div>*@
                </div>
            </div>
            <div class="clear">
            </div>
            @Html.Action("ShareCategoryNavigation", "Catalog", new { currentCategoryId = 177/*159,177*/, currentProductId = 0 })

        </div>
    </div>
</div>

